package com.github.springcloud.good.controller;

import com.github.springcloud.good.api.GoodService;
import com.github.springcloud.good.dto.CreateGoodDto;
import com.github.springcloud.good.vo.GoodVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * Created by zhaozuowen on 2018/7/12.
 */
@RestController
@RequestMapping("/good")
@RefreshScope
public class GoodController {

    @Autowired
    private GoodService goodService;

    @Value("${foot.se}")
    private String foot;

    @RequestMapping(value = "/getByGoodNo/{goodNo}",method = RequestMethod.GET)
    public GoodVo getByGoodNo(@PathVariable("goodNo") String goodNo) {
        return goodService.getByGoodNo(goodNo);
    }


    @RequestMapping(value = "/createGood",method = RequestMethod.POST)
    public void createGood(@RequestBody CreateGoodDto createGoodDto) {
         goodService.createGood(createGoodDto);
    }


    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public void test() {
        System.out.println(foot);
    }
}
